PACKAGE_NAME = ardesia
PACKAGE_VERSION = "0.2"
SUBDIRS = $(PACKAGE_NAME) po
PACKAGE_FULL_NAME=$(PACKAGE_NAME)-$(PACKAGE_VERSION)
PACKAGEDIR = debian
CONTROLSRC = $(PACKAGEDIR)/control
PACKAGE = "$(PACKAGEDIR)/$(PACKAGE_FULL_NAME)"
DEBIANCONTROLDIR = $(PACKAGE)/DEBIAN
ARDESIA_SUBDIR =  $(PACKAGE_NAME)
AC_LOCAL_AMFLAGS = -I m4

check-gettext:
	@if test x$(USE_NLS) != "xyes" ; then echo "Missing gettext. Rerun configure and check for" \
	"'checking whether to use NLS... yes'!" ; exit 1 ; fi

update-po: check-gettext
	@find $(PACKAGE_NAME) -name "*.c" -print | sort >> po/POTFILES.in.2 ; \
	find $(PACKAGE_NAME) -name "*.glade" >> po/POTFILES.in.2 ; \
	if diff po/POTFILES.in po/POTFILES.in.2 >/dev/null 2>&1 ; then \
		rm -f po/POTFILES.in.2 ; \
	else \
		mv po/POTFILES.in.2 po/POTFILES.in ; \
	fi
	cd po && $(MAKE) $(AM_MAKEFLAGS) update-po

update-gmo: check-gettext
	cd po && $(MAKE) $(AM_MAKEFLAGS) update-gmo

force-update-gmo: check-gettext
	touch po/*.po
	cd po && $(MAKE) $(AM_MAKEFLAGS) update-gmo

force-update-gmo-%: check-gettext
	@language=`echo $@ | sed s/force-update-gmo-//` ; \
	if test ! -f po/$$language.po ; then echo "file po/$$language.po does not exist" ; exit 1 ; fi ; \
	touch po/$$language.po ; \
	cd po && $(MAKE) $(AM_MAKEFLAGS) update-gmo

.PHONY: check-gettext update-po update-gmo force-update-gmo

all:

	@for i in $(SUBDIRS); do \
	echo "make all in $$i..."; \
	(cd $$i; $(MAKE) all); done

 
install:

	@for i in $(SUBDIRS); do \
	echo "Installing in $$i..."; \
	(cd $$i; $(MAKE) install); done
	mkdir -p $(DESTDIR)$(prefix)/share/applications; \
	if test -w $(DESTDIR)$(prefix)/share/applications; then \
		sed 's:/share:$(prefix)/share:' applications/ardesia.desktop.stub > applications/ardesia.desktop; \
		install applications/ardesia.desktop $(DESTDIR)$(prefix)/share/applications; \
	fi
	mkdir -p $(DESTDIR)$(prefix)/share/pixmaps; \
	if test -w $(DESTDIR)$(prefix)/share/pixmaps; then \
		mkdir -p $(DESTDIR)$(prefix)/share/pixmaps; \
		install pixmaps/ardesia.png $(DESTDIR)$(prefix)/share/pixmaps; \
	fi

 
clean:

	@for i in $(SUBDIRS); do \
	echo "Clearing in $$i..."; \
	(cd $$i; $(MAKE) clean); done
	rm -fr autom4te.cache
	rm -f  applications/ardesia.desktop
	rm -fr debian/tmp
	rm -fr debian/files
	rm -fr debian/ardesia
	rm -f  debian/debhelper.log
	rm -fr debian/substvars
	rm -f  ardesia/config.log

realclean:
	rm -fr ardesia/src/.deps
	rm -fr ardesia/src/Makefile
	rm -f  ardesia/po/Makefile
	rm -f  ardesia/Makefile
	rm -f  ardesia/config.status
	rm -f  ardesia/config.log
	rm -f  ardesia/config.status
	rm -f  config.log
	rm -f  config.status
	rm -f  Makefile


uninstall:

	@for i in $(SUBDIRS); do \
	echo "Clearing in $$i..."; \
	(cd $$i; $(MAKE) uninstall); done
	if test -w $(DESTDIR)$(prefix)/share/applications; then \
		rm -f $(DESTDIR)$(prefix)/share/applications/ardesia.desktop ; \
	fi
	if test -w $(DESTDIR)$(prefix)/share/pixmaps; then \
		rm -f  $(DESTDIR)$(prefix)/share/pixmaps/ardesia.png; \
	fi
	rm -fr  $(DESTDIR)$(prefix)/share/ardesia


deb:
     
	debuild -us -uc -b 
         

ACLOCAL_AMFLAGS = -I m4

EXTRA_DIST = config.rpath
